package com.example.day_blog.mapper;

import com.example.day_blog.model.Comment;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author starsea
 * @date 2024-01-27 12:47
 */
@Mapper
public interface CommentMapper {
    @Select("SELECT * FROM blog_spring.comment where blog_id=#{blogId} order by create_time desc;")
    List<Comment> sumComment(Integer blogId);
    //添加新的评论
    @Insert("insert into blog_spring.comment (user_name,user_id,blog_id,content) values (#{userName},#{userId},#{blogId},#{content});")
    Integer insertComment(Comment comment);

}
